home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Date & Calendars / 3-month.izs < prev    next >
Text File  |  2005-07-20  |  3KB  |  127 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>3-month calendar
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>Sometimes it's convenient to have shown the calendar for multiple months. With that in mind, Ada's script displays the last, present, and next month's calendar. Customizable background color and font size.
  7. <!/DESCRIPTION> 
  8.  
  9. <!CATEGORY>Calenders<!/CATEGORY>
  10.  
  11. <!SCRIPT>
  12. <!-- START OF SCRIPT -->
  13. <!-- Simply insert the below code to the <BODY> section of your page:                -->
  14. <SCRIPT LANGUAGE="JavaScript">
  15.  
  16. /*
  17. 3-month calendar script- Ada Shimar (adashimar@chalktv.com)
  18. */
  19.  
  20. //Specify bgcolor of calendar
  21. var bg="#FFFFE1"
  22.  
  23. //Specify font size
  24. var fs=2
  25.  
  26. var flg = 0;
  27. //var fs = 1;
  28. M = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
  29. D = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
  30. function getBgn() {
  31. pdy = new Date();        // today
  32. pmo = pdy.getMonth();    // present month
  33. pyr = pdy.getYear();     // present year
  34. if (pyr < 2000)    // Y2K Fix, Isaac Powell
  35. pyr = pyr + 1900; // http://onyx.idbsu.edu/~ipowell
  36. yr = yr1 = (pmo==0?pyr-1:pyr); // last month's year
  37. mo = (pmo==0?11:pmo-1);  // last month
  38. bgn = new Date(M[mo]+" 1,"+yr1); // assign to date
  39. document.write('<TABLE BORDER=0><TR><TD VALIGN=TOP>');
  40. Calendar();           // Send last month to screen
  41. document.write('</TD><TD VALIGN=TOP>');
  42. yr = pyr;                // present year
  43. mo = pmo;                // present month
  44. bgn = new Date(M[mo]+" 1,"+yr); // assign to date
  45. Calendar();           // Send this month to screen
  46. document.write('</TD><TD VALIGN=TOP>');
  47. yr = (pmo==11?pyr+1:pyr); // next month's year
  48. mo = (pmo==11?0:pmo+1);   // next month
  49. bgn = new Date(M[mo]+" 1,"+yr); // assign to date
  50. Calendar();           // Send next month to screen
  51. document.write('</TD></TR></TABLE>'); // Finish up
  52. }
  53. function Calendar(){
  54. dy = bgn.getDay();
  55. yr = eval(yr);
  56. d = "312831303130313130313031";
  57. if (yr / 4 == Math.floor(yr / 4)) {
  58. d = d.substring(0, 2) + "29" + d.substring(4, d.length);
  59. }
  60. pos = (mo * 2);
  61. ld = eval(d.substring(pos, pos + 2));
  62. document.write("<TABLE BORDER=1"
  63. + " BGCOLOR='" + bg
  64. + "'><TR><TD ALIGN=CENTER COLSPAN=7>"
  65. + "<FONT SIZE=" + fs + ">" + M[mo] + " " + yr
  66. + "</FONT></TD></TR><TR><TR>");
  67. for (var i = 0;i < 7;i ++) {
  68. document.write("<TD ALIGN=CENTER>"
  69. +"<FONT SIZE="+fs+">" + D[i] + "</FONT></TD>");
  70. }
  71. document.write("</TR><TR>");
  72. ctr = 0;
  73. for (var i = 0;i < 7; i++){
  74. if (i < dy) {
  75. document.write("<TD ALIGN=CENTER>"
  76. +"<FONT SIZE=" + fs + "> </FONT>"
  77. +"</TD>");
  78. }
  79. else {
  80. ctr++;
  81. document.write("<TD ALIGN=CENTER>"
  82. + "<FONT SIZE=" + fs + ">" + ctr + "</FONT>"
  83. + "</TD>");
  84.    }
  85. }
  86. document.write("</TR><TR>");
  87. while (ctr < ld) {
  88. for (var i = 0;i < 7; i++){
  89. ctr++;
  90. if (ctr > ld){
  91. document.write("<TD ALIGN=CENTER>"
  92. + " </TD>");
  93. }
  94. else {
  95. document.write("<TD ALIGN=CENTER>"
  96. + "<FONT SIZE=" + fs + ">" + ctr + "</FONT>"
  97. + "</TD>");
  98.    }
  99. }
  100. document.write("</TR><TR>");
  101. }
  102. document.write("</TR></TABLE>");
  103. }
  104.  
  105. </SCRIPT>
  106.  
  107. <CENTER>
  108. <P><B>JavaScript 3-month Calendar</B>
  109. <SCRIPT LANGUAGE="JavaScript">
  110.  
  111. getBgn();
  112.  
  113. </SCRIPT>
  114. </CENTER>
  115.  
  116. <!-- END OF SCRIPT -->
  117. <!/SCRIPT>
  118.  
  119. <!PREVIEW>
  120. <!-- START OF SCRIPT -->
  121. <!-- Simply insert the below code to the <BODY> section of your page:                -->
  122.  
  123.  
  124. <!-- END OF SCRIPT -->
  125. <!/PREVIEW>
  126.  
  127. <!RELATED>NONE<!/RELATED>